<template>
  <div class="material-print" ref="print">
    <h2 v-if="title==''">入库明细</h2>
    <h2 v-else>{{title}}入库明细</h2>
    <table cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>序号</th>
          <th>单据编码</th>
          <th>业务类型</th>
          <th>业务部门</th>
          <th>业务人员</th>
       <th v-if="pathQuery.workType=='0'">供方</th>
           <th v-if="pathQuery.workType=='1'">加工设备</th>
          <th v-if="pathQuery.workType=='2'">外协厂家</th>
          <th>物料编码</th>
          <th v-if="wmSort.sortAttrMerge==1">物料名称</th>
          <th v-if="wmSort.sortAttrMerge==0">物料名称</th>
          <th v-if="wmSort.sortAttrMerge!==1">{{wmSort.sortAttrAlia}}</th>
          <th>计量单位</th>
           <th>属性</th>
          <th>批次日期</th>
          <th>入库数量</th>
          <th v-if="priceStatus">单价</th>
          <th v-if="priceStatus">金额</th>
          <th v-if="locationStatus">货位</th>
        </tr>
      </thead>
      <tbody v-if="printData.length>0">
        <tr v-for="(item,index) in printData" :key="index">
          <td>{{item.id}}</td>
          <td>{{item.wmCode}}</td>
          <td>{{item.workType}}</td>
          <td>{{item.workDept}}</td>
          <td>{{item.workStaff}}</td>
       <td v-if="pathQuery.workType=='0'">{{item.supplier}}</td>
           <td v-if="pathQuery.workType=='1'">{{item.productionLine}}</td>
          <td v-if="pathQuery.workType=='2'">{{item.outsource}}</td>
          <td>{{item.invCode}}</td>
          <td v-if="wmSort.sortAttrMerge==1">{{item.invName}}{{item.invAttribute}}</td>
          <td v-if="wmSort.sortAttrMerge==0">{{item.invName}}</td>
          <td v-if="wmSort.sortAttrMerge!==1">{{item.invAttribute}}</td>
          <td>{{item.unitName}}</td>
          <td>{{item.attribute}}</td>
          <td>{{item.batchDate}}</td>
          <td>{{item.inQuantity}}</td>
          <td v-if="priceStatus">{{item.price}}</td>
          <td v-if="priceStatus">{{item.amount}}</td>
          <td v-if="locationStatus">{{item.location}}</td>
        </tr>
      </tbody>
    </table>
  </div>

</template>

<script>
  export default {
    data() {
      return {

      }
    },
    mounted() {
      console.log( this.pathQuery)
    },
    props: {
      // 类型
      printData: {
        type: Array,
        default () {
          return []
        }
      },
      title: {
        type: String,
        default () {
          return ""
        }
      },
      //仓库对应分类信息
      wmSort: {
        type: Object,
        default () {
          return {};
        }
      },
      pathQuery: {
        type: Object,
        default () {
          return {};
        }
      },
      priceStatus:{
        type: Boolean,
        default:true
      },
      locationStatus:{
        type: Boolean,
        default:true
      }
    }
  }
</script>

<style lang="scss" scoped="scoped">
  @media print {
    .material-print {
      display: block !important;
    }
  }

  .material-print {
    display: none;

    h2 {
      text-align: center;
      color: #515a6e;
    }

    table {
      width: 100%;
      margin-bottom: 20px;
      border-left: 1px solid #ccc;

      th {
        text-align: center;
        font-size: 14px;
        padding: 5px;
        border-bottom: 1px solid #ccc;
        border-right: 1px solid #ccc;
        border-top: 1px solid #ccc;
      }

      td {
        text-align: center;
        font-size: 13px;
        color: #606266;
        border-bottom: 1px solid #ccc;
        border-right: 1px solid #ccc;
        padding: 5px;
      }
    }
  }
</style>
